import 'vue/jsx'

// 引入windi css
import '@/plugins/unocss'

// 导入全局的svg图标
import '@/plugins/svgIcon'

// 初始化多语言
import { setupI18n } from '@/plugins/vueI18n'

// 引入状态管理
import { setupStore } from '@/store'

// 全局组件
import { setupGlobCom } from '@/components'

// 引入element-plus
import { setupElementPlus } from '@/plugins/elementPlus'

// 引入全局样式
import '@/styles/index.less'

// 引入动画
import '@/plugins/animate.css'

// 路由
import { setupRouter } from './router'
//vform相关
import Draggable from '@/../lib/vuedraggable/dist/vuedraggable.umd.js'
import 'element-plus/dist/index.css'
import '@/styles/index.scss'
import '@/iconfont/iconfont.css'
import { registerIcon } from '@/utils/el-icons'
import ContainerWidgets from '@/components/variant-form3/form-designer/form-widget/container-widget/index.js'
import ContainerItems from '@/components/variant-form3/form-render/container-item/index.js'
import ElementPlus from 'element-plus'

import { addDirective } from '@/utils/directive'
import { installI18n } from '@/utils/i18n'
import { loadExtension } from '@/extension/extension-loader'
// 权限
import { setupPermission } from './directives'

import { createApp } from 'vue'

import App from './App.vue'

import './permission'

// 创建实例
const setupAll = async () => {
  const app = createApp(App)
  // app.use(ElementPlus)
  await setupI18n(app)

  setupStore(app)

  setupGlobCom(app)

  setupElementPlus(app)

  setupRouter(app)

  registerIcon(app)
  app.component('draggable', Draggable)
  addDirective(app)
  installI18n(app)
  app.use(ContainerWidgets)
  app.use(ContainerItems)
  loadExtension(app)

  setupPermission(app)

  app.mount('#app')
}

setupAll()
